﻿using System.Windows;
using System.Windows.Controls;
using FlowgraphViewer.ViewModel;
using FlowgraphViewer.Model;
using System.Windows.Media;

namespace FlowgraphViewer.Views
{
    /// <summary>
    /// Description for FlowNodeView.
    /// </summary>
    public partial class FlowNodeView : UserControl
    {
        /// <summary>
        /// Initializes a new instance of the FlowNodeView class.
        /// </summary>
        public FlowNodeView()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(FlowNodeView_Loaded);
        }
        void FlowNodeView_Loaded(object sender, RoutedEventArgs e)
        {
            FlowNodeViewModel vm = new FlowNodeViewModel { Node = this.DataContext as FlowNodeInstance };

            this.DataContext = vm;

            Canvas.SetLeft(this, vm.Node.Position.X);
            Canvas.SetTop(this, vm.Node.Position.Y);
        }
    }
}